Repository navigation
Avoid copying Activity tags and links when sampling - #135277
Conversation
Do not copy links and tags when creating a new `Activity` when `ActivitySamplingResult.PropagationData` is specified. Fixes dotnet#135007.
|
Azure Pipelines: Successfully started running 3 pipeline(s). 13 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
|
Tagging subscribers to this area: @steveisok, @dotnet/area-system-diagnostics-tracing |
|
Tagging subscribers to this area: @dotnet/area-system-diagnostics-activity |
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Sampler tags violate their documented contract, and the behavioral change needs compatibility documentation.
Review effort: Balanced
Findings: 1
What changed in this PR
Optimizes Activity creation for PropagationData sampling.
Changes:
- Skips copying creation tags, links, and sampler tags.
- Adds coverage for parent formats and multiple listeners.
| File | Description |
|---|---|
Activity.cs |
Conditionally skips data copying. |
ActivitySourceTests.cs |
Tests the revised sampling behavior. |
- Harden check for skipping tags. - Don't skip sampler tags.
Update `ActivitySource,CreateActivity()` parameter documentation for `tags` and `links` for new behaviour.
|
Added When you commit this breaking change:
Tagging @dotnet/compat for awareness of the breaking change. |
Breaking Change DocumentationA breaking change draft has been prepared for this PR. 👉 Click here to create the issue in dotnet/docs After creating the issue, please email a link to it to the Note This documentation was generated with AI assistance from Copilot.
|
|
Breaking change issue dotnet/docs#56340 is filed. |

Do not copy links and tags when creating a new
ActivitywhenActivitySamplingResult.PropagationDatais specified.Fixes #135007.
Benchmarks
BenchmarkDotNet, default job,
--inProcess --affinity 4095, creating, starting and stopping an activity with the listener returning the given sampling result.mainvs. PR; the tag set is the 9 tags ASP.NET Core-style server instrumentation passes at creation, plus one link. Ratios are PR / main (lower is better).PropagationDataNoTagsPropagationDataNineTagsPropagationDataNineTagsAndLinkAllDataAndRecordedNoTagsAllDataAndRecordedNineTagsAllDataAndRecordedNineTagsAndLinkBenchmark Code